*12-09-24_bdmrobustness.do

clear
macro drop _all
global filetree /Users/Allan/Dropbox/!!Papers/Liberal Peace/12-02-21_ISQ_commentary/DOR_ISQ_2013_Replication/M_Rep

cd "$filetree"

set more off

use "MM_precise.dta", clear

sort ccode1 ccode2 year
gen specification="NA"
gen specnumber=.
gen n=.
gen bdmCoefficient=.
gen bdmSE=.
gen CIElCoefficient=.
gen CIElSE=.
gen bdmpvalues=.
gen CIElpvalues=.


gen bdmCIElc=bdm*CIElc

sort ccode1 ccode2 year
global controls lncprt mjpw cntg dist numstate 

global fmcontrols lncprt mjpw cntg dist numstate fpceyrs fspl1 fspl2 fspl3

global amcontrols lncprt mjpw cntg dist numstate apceyrs aspl1 aspl2 aspl3

local j=0


**M2 with 4 dependent variables x interaction = 8 models
local j=`j'+1
local spec`j' "'"
local covars`j' "mzmidonl CIEl  bdm 					   $controls midyears*"


local j=`j'+1
local spec`j' "O'"
local covars`j' "mzmidol CIEl  bdm 					   $controls midyears*"


local j=`j'+1
local spec`j' "F'"
local covars`j' "mzfmidonl CIEl  bdm 					   $controls fatalyears*"


local j=`j'+1
local spec`j' "FO'"
local covars`j'  "mzfmidol CIEl  bdm 					   $controls fatalyears*"


local j=`j'+1
local spec`j'  "I'"
local covars`j'  "mzmidonl CIElc  bdm bdmCIElc 					   $controls midyears*"


local j=`j'+1
local spec`j'  "OI'"
local covars`j'  "mzmidol CIElc  bdm 	 bdmCIElc 				   $controls midyears*"


local j=`j'+1
local spec`j'  "FI'"
local covars`j'  "mzfmidonl CIElc  bdm 		 bdmCIElc 			   $controls fatalyears*"


local j=`j'+1
local spec`j'  "FOI'"
local covars`j' "mzfmidol CIElc  bdm  	bdmCIElc 				   $controls fatalyears*"



**M2 with DemocracyHigh, with 4 dependent variables x interaction = 8 models
local j=`j'+1
local spec`j' "D'"
local covars`j' "mzmidonl CIEl  bdm  dmh 					   $controls midyears*"

 
local j=`j'+1
local spec`j'  "OD'"
local covars`j'  "mzmidol CIEl  bdm  dmh 					   $controls midyears*"


local j=`j'+1
local spec`j'  "FD'"
local covars`j'  "mzfmidonl CIEl  bdm  dmh					   $controls fatalyears*"


local j=`j'+1
local spec`j'  "FOD'"
local covars`j'  "mzfmidol CIEl  bdm  dmh					   $controls fatalyears*"



local j=`j'+1
local spec`j'  "ID'"
local covars`j'  "mzmidonl CIElc  bdm bdmCIElc 	 dmh 				   $controls midyears*"


local j=`j'+1
local spec`j'  "OID'"
local covars`j'  "mzmidol CIElc  bdm 	 bdmCIElc 	 dmh 			   $controls midyears*"


local j=`j'+1
local spec`j'  "FID'"
local covars`j'  "mzfmidonl CIElc  bdm 		 bdmCIElc 	 dmh 		   $controls fatalyears*"


local j=`j'+1
local spec`j'  "FOID'"
local covars`j'  "mzfmidol CIElc  bdm  	bdmCIElc 	 dmh 			   $controls fatalyears*"




**Estimating Models, Saving Values
forvalues k=1(1)`j' {
logit `covars`k'', cl(ID) nolog
replace n= e(N)   if _n==`k'
replace specification="`spec`k''" if _n==`k'
replace specnumber=`k' if _n==`k'
replace bdmCoefficient=_b[bdm] if _n==`k'
replace bdmSE=_se[bdm] if _n==`k'
replace CIElCoefficient=_b[CIEl] if _n==`k'
replace CIElSE=_se[CIEl] if _n==`k'
}
 

replace bdmpvalues=2*normal(-abs(bdmCoefficient/bdmSE))
replace CIElpvalues=2*normal(-abs(CIElCoefficient/CIElSE))
keep specification-CIElpvalues
drop if specnumber==.
saveold "robustnessbdm.dta", replace





**Analyses with no ln(life insurance) or GDP

clear
macro drop _all
global filetree /Users/Allan/Dropbox/!!Papers/Liberal Peace/12-02-21_ISQ_commentary/DOR_ISQ_2013_Replication/M_Rep

cd "$filetree"

set more off

use "MM_precise.dta", clear

sort ccode1 ccode2 year
gen specification="NA"

gen specnumber=.
gen n=.
gen bdmCoefficient=.
gen bdmSE=.
gen CIElCoefficient=.
gen CIElSE=.
gen bdmpvalues=.
gen CIElpvalues=.

sort ccode1 ccode2 year
global controls lncprt mjpw cntg dist numstate 

global fmcontrols lncprt mjpw cntg dist numstate fpceyrs fspl1 fspl2 fspl3

global amcontrols lncprt mjpw cntg dist numstate apceyrs aspl1 aspl2 aspl3

local j=0

**M1 with 4 dependent variables x DemocracyHigh = 8 models
local j=`j'+1
local spec`j' "n'"
local covars`j' "mzmidonl   bdm 					   $controls midyears*"

local j=`j'+1
local spec`j' "On'"
local covars`j' "mzmidol   bdm 					   $controls midyears*"

local j=`j'+1
local spec`j' "Fn'"
local covars`j' "mzfmidonl   bdm 					   $controls fatalyears*"

local j=`j'+1
local spec`j' "FOn'"
local covars`j' "mzfmidol   bdm 					   $controls fatalyears*"


local j=`j'+1
local spec`j' "Dn'"
local covars`j' "mzmidonl   bdm  dmh 					   $controls midyears*"

local j=`j'+1
local spec`j' "ODn'"
local covars`j' "mzmidol   bdm  dmh 					   $controls midyears*"

local j=`j'+1
local spec`j' "FDn'"
local covars`j' "mzfmidonl   bdm  dmh 					   $controls fatalyears*"

local j=`j'+1
local spec`j' "FODn'"
local covars`j' "mzfmidol   bdm  dmh					   $controls fatalyears*"



**Estimating Models, Saving Values
forvalues k=1(1)`j' {
logit `covars`k'', cl(ID) nolog
replace n= e(N)   if _n==`k'
replace specification="`spec`k''" if _n==`k'
replace specnumber=`k' if _n==`k'
replace bdmCoefficient=_b[bdm] if _n==`k'
replace bdmSE=_se[bdm] if _n==`k'
*replace CIElCoefficient=_b[CIEl] if _n==`k'
*replace CIElSE=_se[CIEl] if _n==`k'
}
 
replace bdmpvalues=2*normal(-abs(bdmCoefficient/bdmSE))
replace CIElpvalues=2*normal(-abs(CIElCoefficient/CIElSE))
keep specification-CIElpvalues
drop if specnumber==.
saveold "robustnessbdm2.dta", replace

